avoid current_thread sometimes
authorTom Tromey <tromey@redhat.com>
Fri, 5 Jul 2013 02:00:54 +0000 (20:00 -0600)
committerTom Tromey <tromey@redhat.com>
Fri, 5 Jul 2013 02:00:54 +0000 (20:00 -0600)
this tweaks thread.c to use 'self' instead of current_thread
in a couple spots.  this is clearer and more robust

src/thread.c

index 8a81a1021a63851bb5010a45c8867e53d3daa6a6..99ca21bdc847af1089065c2a22e82631fff00554 100644 (file)
@@ -337,7 +337,7 @@ condition_wait_callback (void *arg)
   Lisp_Object cond;
 
   XSETCONDVAR (cond, cvar);
-  current_thread->event_object = cond;
+  self->event_object = cond;
   saved_count = lisp_mutex_unlock_for_wait (&mutex->mutex);
   /* If we were signalled while unlocking, we skip the wait, but we
      still must reacquire our lock.  */
@@ -348,7 +348,7 @@ condition_wait_callback (void *arg)
       self->wait_condvar = NULL;
     }
   lisp_mutex_lock (&mutex->mutex, saved_count);
-  current_thread->event_object = Qnil;
+  self->event_object = Qnil;
   post_acquire_global_lock (self);
 }
 
@@ -614,6 +614,7 @@ static Lisp_Object
 invoke_thread_function (void)
 {
   Lisp_Object iter;
+  volatile struct thread_state *self = current_thread;
 
   int count = SPECPDL_INDEX ();